'use strict'
import React from 'react'
import style from './css.css'
import changeTime from '../../config/changeTime'
import { View } from '../../component'

class Item extends React.Component {
  static propTypes = {
    item: PropTypes.object
  }
  render () {
    const { headurl, name, time } = this.props.item
    const n = name.length < 7 ? name : name.substring(0, 7) + '...'
    return (
      <View className={style.recordItem}>
        <View style={{ backgroundImage: `url(${headurl})` }} className={style.recordItemImage}></View>
        <View className={style.recordItemName}>{ n }</View>
        <View className={style.recordItemTime}>{ changeTime(time) }</View>
      </View>
    )
  }
}

export default Item
